<template>
<Layout class="container">
  <Sider ref="sidebar" :width="240">
    <h2 class="brand">后台管理系统</h2>
    <Menu theme="dark" @on-select="handleMenu">
      <Submenu name="system">
        <template slot="title"> <Icon type="ios-paper" /> <span>系统管理</span> </template>
        <MenuItem name="dept">部门管理</MenuItem>
        <MenuItem name="user">用户管理</MenuItem>
      </Submenu>
      <Submenu name="logger">
        <template slot="title"> <Icon type="ios-people" /> <span>日志管理</span> </template>
        <MenuItem name="session"> <span>会话日志</span> </MenuItem>
        <MenuItem name="oprater"> <span>操作日志</span> </MenuItem>
      </Submenu>
    </Menu>
  </Sider>
  <Layout>
    <Header class="header">
      <Icon type="md-menu" size="24"></Icon>
    </Header>
    <Content class="content">
      <router-view />
    </Content>
  </Layout>
</Layout>
</template>
<script>
export default {
  name: 'index',
  methods: {
    handleMenu (item) {
      let { name, params, query } = {}
      if (typeof item === 'string') {
        name = item
      } else {
        name = route.name
        params = route.params
        query = route.query
      }
      this.$router.push({ name, params, query })
    }
  }
}
</script>
